package crm.servlet;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import crm.entity.Employee;
import crm.entity.Industry;
import crm.entity.Levels;
import crm.entity.Sources;
import crm.service.EmployeeService;
import crm.service.IndustryService;
import crm.service.LevelsService;
import crm.service.SourcesService;
import crm.service.impl.EmployeeServiceImpl;
import crm.service.impl.IndustryServiceImpl;
import crm.service.impl.LevelsServiceImpl;
import crm.service.impl.SourcesServiceImpl;

/**
 * Servlet implementation class CustomerAddJumpServlet
 */
public class CustomerAddJumpServlet extends HttpServlet {
	private static final long serialVersionUID = 1L; 

	private EmployeeService employeeService = new EmployeeServiceImpl();
    private LevelsService levelsService = new LevelsServiceImpl();	
	private IndustryService industryService = new IndustryServiceImpl();
	private SourcesService SourcesService = new SourcesServiceImpl();
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	          doPost(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
		
		
		try {
			
			
			
			List<Employee> employeeList = employeeService.getEmployeeList();
			
			List<Levels> levelsList = levelsService.getLevelsList();
			 
			List<Sources> sourcesList = SourcesService.getSourcesList();
			
			List<Industry> industryList = industryService.getIndustryList();
			
			request.setAttribute("employeeList", employeeList);
			request.setAttribute("levelsList", levelsList);
			request.setAttribute("sourcesList", sourcesList);
			request.setAttribute("industryList", industryList);
			
			
			request.getRequestDispatcher("/customer_add.jsp").forward(request, response);
			
			
			
			
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (NoSuchFieldException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SecurityException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (ServletException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
